#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QProgressDialog>
#include <QMutex>
#include <QThreadPool>

#include "extendedFilesystemModel.h"
#include "copyThread.h"

typedef QSharedPointer<ExtendedFileSystemModel> ExtendedFileSystemModelPtr;
typedef QSharedPointer<QProgressDialog> QProgressDialogPtr;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

public slots:
    void dragDropPaths(const QString& pathFrom, const QString& pathTo);
    void showProgressDialog(QProgressDialogPtr progressPtr);
    void contextMenueRightTreeView(const QPoint& point);
    void contextMenueLeftTreeView(const QPoint& point);

private:
    void copyFile(const QString& filePathFrom, const QString& filePathTo);
    void copyDir(const QString& dirPathFrom, const QString& dirPathTo);
    void doCopy(const QString& filePathFrom, const QString& filePathTo);
    QString askRename();
    bool askRemove(const QString& str);
    void doRename(const QString& currentPath);
    void doRemove(const QString& filePath);

private slots:
    void onRemoveLeft();
    void onRenameLeft();

    void onRemoveRight();
    void onRenameRight();

private:
    QSharedPointer<Ui::MainWindow>      ui;
    ExtendedFileSystemModelPtr          m_Model;
    QThreadPool                         m_threadPool;
};

#endif // MAINWINDOW_H
